package com.wee.fragment;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.Gallery;

/**
 * Created by Solomon on 2015/11/6.
 */
public class GalleryView extends Gallery {
    public GalleryView(Context paramContext){
        super(paramContext);
    }

    public GalleryView(Context paramContext, AttributeSet paramAttributeSet){
        super(paramContext, paramAttributeSet);
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        if (e1.getX() - e2.getX() < 0.0F){
            onKeyDown(KeyEvent.KEYCODE_DPAD_LEFT,null);
        }else{
            onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT,null);
        }
        return true;
    }

}
